package src.com.foreknow.demo12;

public class Student {
    public String name;
    public static int count;

    public  void say(){
        language();//非静态方法中可以调用静态方法
        System.out.println("说话....");
    }

    public static void language(){
        //say();//静态方法中不能调用非静态方法，除非调用的方法也static的
        System.out.println("语言...");
    }

    public static void main(String[] args) {
        Student s1 = new Student();
        s1.name = "fender";
        s1.count = 1;

        Student s2 = new Student();
        s2.name = "gibson";
        s2.count = 100;

        System.out.println(s1.name);
        System.out.println(s1.count);
        System.out.println("---------");
        System.out.println(s2.name);
        System.out.println(s2.count);

        //调用静态方法只需通过：类名.方法名（参数）
        Student.language();
        //非静态方法一定要通过对象来调用，对象名.方法名（参数）
        s1.say();
        s2.say();

    }

}




















